<?php

class penyakit{

        var $host;
        var $user;
        var $pass;
        var $dbnm;
        var $db;
        
        function __construct($host,$user,$pass,$dbnm){
			    $this->host = $host;
                $this->user = $user;
                $this->pass = $pass;
                $this->dbnm = $dbnm;
        }
        
        function _connect(){
                $this->db = mysql_connect($this->host,$this->user,$this->pass);
                mysql_select_db($this->dbnm,$this->db);
        }
        
                function get_data(){
                        
                        $this->_connect();
                        $sql = 'SELECT * FROM detailpenyakit ';
                        $result = mysql_query($sql);
                        return $result;
                }
                
                function penyakit($data){
                
                        $this->_connect();
                        $sql = "
                                INSERT 
                                INTO
                                detailpenyakit
                                (
                                        Kode,
                                        NamaPenyakit,
                                        DeskripsiPenyakit
								)
                                VALUES
                                (
                                        '".$data['Kode11']."',
                                        '".$data['NamaPenyakitt']."',
                                        '".$data['DeskripsiPenyakitt']."'
                                        
								 )
                        ";
					
                        $result = mysql_query($sql);
						if($result){	
							header('location:adminpenyakit.php?message=success');
						}
						else {
							header('location:adminpenyakit.php?message=warning');
						}
						return $result;
                }
}